-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rectangle update #338
base: master
Are you sure you want to change the base?
Rectangle update #338
Conversation
Codecov Report
@@ Coverage Diff @@
## master #338 +/- ##
==========================================
+ Coverage 37.13% 37.47% +0.34%
==========================================
Files 18 18
Lines 3089 3082 -7
==========================================
+ Hits 1147 1155 +8
+ Misses 1942 1927 -15
Continue to review full report at Codecov.
|
i hesitate to get rid of also, what about |
There are some potential issues with implementing transformations at backend level:
Compose avoids all these issues by implementing transformations at Compose level. The following code set_default_graphic_size(6.5inch, 6.5inch)
θ = -π/10
img1 = compose(context(units=UnitBox(0,0,3,1)), fill(nothing), stroke("blue"),
(context(), circle([0.5,1.5,2.5],[0.5],[0.1]), stroke("silver")),
(context(rotation=Rotation(-π/6,0.5,0.5)), ngon(0.5,0.5,0.1,30)),
(context(rotation=Rotation(θ,1.5,0.4)), line([(1.0,0.4),(2.0,0.4)]), stroke("black")),
(context(mirror=Mirror(θ,1.5,0.4)), circle(1.5,0.5,0.1)),
(context(shear=Shear(1.0,0.0,2.5,0.5)), ngon(2.5,0.5,0.1,30))
)
img2 = compose(context(units=UnitBox(0,0,3,1)), fill(nothing), stroke("blue"),
(context(), ellipse([0.5,1.5,2.5],[0.5],[0.2],[0.1]), stroke("silver")),
(context(rotation=Rotation(-π/6,0.5,0.5)), ellipse(0.5,0.5,0.2,0.1)),
(context(rotation=Rotation(θ,1.5,0.4)), line([(1.0,0.4),(2.0,0.4)]), stroke("black")),
(context(mirror=Mirror(θ,1.5,0.4)), ellipse(1.5,0.5,0.2,0.1)),
(context(shear=Shear(1.0,0.0,2.5,0.5)), ellipse(2.5,0.5,0.2,0.1))
)
X = [(x,y) for x in (0.5,1.5,2.5), y in (0.5, -0.5, 1.5, 0.5) ]
X[:,1] = [x.+(-0.2, 0.0) for x in X[:,1]]
X[:,4] = [x.+(0.2, 0.0) for x in X[:,4]]
img3 = compose(context(units=UnitBox(0,0,3,1)), fill(nothing), stroke("blue"),
(context(), curve(X[:,1],X[:,2],X[:,3],X[:,4]), stroke("silver")),
(context(rotation=Rotation(-π/6,0.5,0.5)), curve(X[1,:]...)),
(context(rotation=Rotation(θ,1.5,0.4)), line([(1.0,0.4),(2.0,0.4)]), stroke("black")),
(context(mirror=Mirror(θ,1.5,0.4)), curve(X[2,:]...)),
(context(shear=Shear(1.0,0.0,2.5,0.5)), curve(X[3,:]...))
)
vstack(img1,img2,img3) |
Ran into errors testing on Gadfly with this PR. Looks like |
do PolygonPrimitives work yet with DateTime types? |
This PR:
Rectangles are now PolygonPrimitives, so they will obey Compose transformations: